package com.retrofit.server.processor;

public final class Print {

  static boolean isPrint=false;

  public static final void log(String msg){
    log(msg,"");
  }

  public static final void log(String msg,Object... args){
    if(!isPrint){
      return ;
    }
    StackTraceElement caller = Thread.currentThread().getStackTrace()[3];
    String callerClazzName = caller.getClassName();
    String tag = callerClazzName.substring(callerClazzName.lastIndexOf(".") + 1);
    StringBuilder sb=new StringBuilder("");
    if(args!=null){
      for (Object arg : args) {
        sb.append(" ").append(arg);
      }
    }
    String msgContent=String.format("%s(%d) :: %s %s",tag,
        caller.getLineNumber(),
        msg == null ? " NUll. " : msg,
        sb.toString());
    System.out.println(">>> "+msgContent);

  }

}
